'''
Created on 17/12/2010

@author: inyaky
'''

from google.appengine.ext import db
from model.fields.uTaskField import TaskField

class StringTaskField(TaskField):

    _value = db.StringProperty()
    
    def getValue(self):
        if self._value:
            return self._value
        else:
            return ''
    
    def setValue(self, aValue):
        self._value = aValue
        self.put()
    
    def toRenderable(self):
        
        if self.getRequired():
            validators = 'required'
        else:
            validators = ''
        
        return [{'fname':self.getName(),'fvalue':self.getValue(),'ftype':self.__class__.__name__,'fkey':self.key(), 'fvalidators':validators}]
